Class University.Address Extends (%SerialObject, %Populate)
{
/* define attributes */
/// The street address.
Property Street As %String(MAXLEN = 80, POPSPEC = "Street()");

/// The city name.
Property City As %String(MAXLEN = 80, POPSPEC = "City()");

/// The 2-letter state abbreviation.
Property State As %String(MAXLEN = 2, POPSPEC = "USState()");

/// The 5-digit U.S. Zone Improvement Plan (ZIP) code.
Property Zip As %String(MAXLEN = 5, POPSPEC = "USZip()");
}

/// Base class person Extends (%Persistent)

Class University.Person Extends (%Persistent, %Populate)
{

Index persidndx On perId [ Unique ];

/* define attributes */
Property perId As %Integer;

Property LName As %String(POPSPEC = "LastName()") [ Required ];

Property FName As %String(POPSPEC = "FirstName()");

Property add As Address;

Property phone As %String(POPSPEC = "USPhone()");

Property birthDate As %Date;

/* define methods */
ClassMethod FindAge() As %Integer
{
}
}

Class University.Faculty Extends Person
{

/* define attributes */
Property rank As %String(VALUELIST = "'Instructor','Assistant','Associate','Professor'");

Property salary As %Numeric;

/* define relationships */
Relationship belongsTo As Department [ Cardinality = one, Inverse = hasFaculty ];

Relationship teaches As ClassSection [ Cardinality = many, Inverse = hasTeacher ];

Relationship advises As Student [ Cardinality = many, Inverse = hasAdvisor ];

Relationship hasEvaluation As Evaluation [ Cardinality = children, Inverse = isEvalOf ];

Relationship chairs As Department [ Cardinality = one, Inverse = hasChair ];

/* define member methods */
ClassMethod giveRaise(amtRaise As %Numeric)
{
}


}

Class University.Student Extends Person
{

/* define properties */
Property credits As %SmallInt;

Property gpa As %Numeric;

/* define relationships */
Relationship hasAdvisor As University.Faculty [ Cardinality = one, Inverse = advises ];

Relationship takesClass As ClassSection [ Cardinality = many, Inverse = hasStudent ];
Relationship earnedGrade As Grade [ Cardinality = many, Inverse = givenStudent ];

/* define member methods */
ClassMethod addCredits(numCredits As %SmallInt)
{
}

/// tells the year the student is in
ClassMethod getStatus() As %String
{
}

}

Class University.Undergraduate Extends Student
{
/* define attributes*/
Property major As %String;

/* define member methods */
ClassMethod changeMajor(newMajor As %String)
{
}

}
Class University.Graduate Extends University.Student
{

/* define attributes*/
Property program As %String;

/* define member methods */
ClassMethod changeProgram(newProgram As %String)
{
}

}

Class University.TeachingAssistant Extends (Graduate, Faculty)
{
/* define attributes*/
Property fundingSource As %String;

Property tuitionRemission As %Numeric;

/* define relationships */

Relationship assists As ClassSection [ Cardinality = one, Inverse = hasTA ];
}

Class University.Department Extends %Persistent
{

/* define attributes */
Property deptCode As %String [ Required ];

Property deptName As %String [ Required ];

Property deptOffice As %String;

Property deptPhone As %String;

/* define relationships */
Relationship hasFaculty As University.Faculty [ Cardinality = many, Inverse = belongsTo ];

Relationship offers As University.Course [ Cardinality = many, Inverse = isOffering ];

Relationship hasChair As University.Faculty [ Cardinality = many, Inverse = chairs ];

}
Class University.Course Extends %Persistent
{

/* define attributes */
Property cNo As %String [ Required ];

Property cTitle As %String [ Required ];

Property credits As %SmallInt;

Property description As %String;

/* define relationships */
Relationship isOffering As University.Department [ Cardinality = one, Inverse = offers ];

Relationship hasPrerequisite As Course [ Cardinality = many, Inverse = isPrereqOf ];

Relationship isPrereqOf As University.Course [ Cardinality = one, Inverse = hasPrerequisite ];

Relationship hasSection As University.ClassSection [ Cardinality = children, Inverse = isSectionOf ];

}

Class University.ClassSection Extends %Persistent
{

/* define attributes */
Property sectionCode As %String [ Required ];

Property schedule As %String;

Property room As %String;

/* define relationships */
Relationship givenIn As Grade [ Cardinality = many, Inverse = givenTo ];

Relationship hasTeacher As University.Faculty [ Cardinality = one, Inverse = teaches ];

Relationship hasStudent As University.Student [ Cardinality = one, Inverse = takesClass ];

Relationship hasTA As University.TeachingAssistant [ Cardinality = many, Inverse = assists ];

Relationship isSectionOf As University.Course [ Cardinality = parent, Inverse = hasSection ];

}

Class University.Evaluation Extends %Persistent
{

/* define attributes*/
Property evalDate As %Date [ Required ];

Property raterName As %String [ Required ];

Property rating As %String(VALUELIST = "1,2,3,4,5");

/* define relationships */
Relationship isEvalOf As University.Faculty [ Cardinality = parent, Inverse = hasEvaluation ];

}
Class University.Grade 
{

/* define attributes */
Property grade As %String(VALUELIST = "'A'.'B','C','D','F','I'");

/* define relationships */
Relationship givenStudent As University.Student [ Cardinality = one, Inverse = earnedGrade ];

Relationship givenTo As University.ClassSection [ Cardinality = one, Inverse = givenIn ];

}

